package com.lengxf.design;

/**
 * 终结符表达式角色
 * By Lengxf
 */
public class DirectionNode extends AbstractNode {
    private final String direction;

    public DirectionNode(String direction) {
        this.direction = direction;
    }

    @Override
    public String interpret() {
        return switch (direction) {
            case "up" -> "向上";
            case "down" -> "向下";
            case "left" -> "向左";
            case "right" -> "向右";
            default -> throw new RuntimeException("not found");
        };
    }

}
